<?php header("Content-Type: text/html; charset=utf-8",true); ?>
<?php
include_once("../models/cls.colaborador.php");

$oColaborador = new colaborador();
$oColaborador->load( $_POST );
if( empty( $_POST["id"] ) )
{
	$add = $oColaborador->insert();
	if($add == 1)
	{
		?>
		<script>
			alert("REGISTRO ADICIONADO!");
			window.location.href="../views/frm.colaborador.php";
		</script>
		<?
	}
}
else{
	$add = $oColaborador->update( $_POST["id"] );
	if($add == 1)
	{
		?>
		<script>
			alert("REGISTRO ALTERADO!");
			window.location.href="../views/frm.colaborador.php";
		</script>
		<?
	}
}
?>